<template>
    <div>
      <input v-model="num1" type="number" placeholder="输入第一个数字">
      <input v-model="num2" type="number" placeholder="输入第二个数字">
      <p>两数之和为: {{ sum }}</p>
    </div>
  </template>
  
  <script setup>
  import { ref, computed } from 'vue';
  
  // 定义两个响应式变量
  const num1 = ref(0);
  const num2 = ref(0);
  
  // 定义计算属性
  const sum = computed(() => {
    return Number(num1.value) + Number(num2.value);
  });
  </script>